package ru.xpparty.scanner;

import org.apache.commons.cli.*;

import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: vladimir
 * Date: 06.12.10
 * Time: 23:34
 * To change this template use File | Settings | File Templates.
 */
public class ScannerRunner {
    public static void main(String[] args) throws ParseException {
        Option hostOption = new Option("h", true, "localhost");
        Option portOption = new Option("p", true, "1");
        Options options = new Options();
        options.addOption(hostOption);
        options.addOption(portOption);
        org.apache.commons.cli.Parser parser = new PosixParser();
        CommandLine commandLine = parser.parse(options, args);
        String host = commandLine.getOptionValue(hostOption.getOpt());
        String port = commandLine.getOptionValue(portOption.getOpt());
        Parser parserScan = new ParserImpl();
        Scanner scanner = new ScannerImpl();
        Map<Host, ResultEnum> result = scanner.scanRange(parserScan.parse(host, port));
        System.out.println(ReportGenerator.createReport(result));
    }
}
